﻿using System;
using System.Collections.Generic;
using BLL;
using Model;

public partial class PCBA_ViewPCBA_ViewPCBAssemblebySN : System.Web.UI.Page
{
    PCBAssemble amd;
    PCBAssembleDetail amds;
    private string pCBASN
    {
        get
        {
            return ViewState["PCBASN"].ToString();
        }
        set
        {
            ViewState["PCBASN"] = value;
        }
    }

    public PCBA_ViewPCBA_ViewPCBAssemblebySN()
    {
        amd = new PCBAssemble();
        amds = new PCBAssembleDetail();
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["PCBASN"] != null)
            {
                pCBASN = Request.QueryString["PCBASN"];
                this.TextBox1.Text = pCBASN;
                BindData();
            }
        }
    }

    protected void BindData()
    {
        IList<PCBAssembleInfo> list = new List<PCBAssembleInfo>();
        PCBAssembleInfo pai = amd.LoadEntity(pCBASN);
        list.Add(pai);
        this.GridView1.DataSource = list;
        this.GridView1.DataBind();
        this.GridView2.DataSource = amds.GetPCBAssembleDetailsbySN(pCBASN);
        this.GridView2.DataBind();
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        pCBASN = this.TextBox1.Text.Trim();
        BindData();
    }
}
